package v1

import (
	"gin_cli/models"
	"gin_cli/pkg/e"
	"net/http"

	"github.com/gin-gonic/gin"
)

type Device struct{}

func (this *Device) GetByDeviceNo(c *gin.Context) {
	deviceNo := c.Param("device_no")
	where := map[string]interface{}{
		"device_number": deviceNo,
	}
	table := "comm_weimaqi,android_screen,comm_lgz"
	data := new(models.Device).GetInfo(where, table)
	c.JSON(http.StatusOK, e.GetResponse(e.SUCCESS, data))
}

func (this *Device) GetList(c *gin.Context) {
	storeId := c.Param("store_id")
	where := map[string]interface{}{
		"store_id": storeId,
		"status":   []int{1, 2, 3, 4, 5, 6, 7, 8, 9},
	}
	pagination := make(map[string]interface{})
	table := ""
	data, _ := new(models.Device).GetList(
		where,
		pagination,
		table,
	)
	c.JSON(http.StatusOK, e.GetResponse(e.SUCCESS, data))
}
